//package cn.yym.test.dao.impl;
//
//import cn.yym.test.dao.IPeopleDao;
//import cn.yym.test.domain.People;
//import cn.yym.test.util.DataSourceUtil;
//import cn.yym.test.util.PageBean;
//import org.apache.commons.dbutils.QueryRunner;
//import org.apache.commons.dbutils.handlers.BeanHandler;
//import org.apache.commons.dbutils.handlers.BeanListHandler;
//
//import javax.sql.DataSource;
//import java.sql.Date;
//import java.sql.SQLException;
//import java.util.List;
//
///**
// * @author admin
// */
//public class PeopleDaoImpl implements IPeopleDao {
//  private   QueryRunner queryRunner =new QueryRunner(DataSourceUtil.getDataSource());
//    @Override
//    public List<People> selectAll() {
//        String sql="select name,gender,email,birthday,createTime,updateTime from people";
//        List<People> query = null;
//        try {
//            query = queryRunner.query(sql, new BeanListHandler<>(People.class));
//        } catch (SQLException sqlException) {
//            sqlException.printStackTrace();
//        }
//        return  query;
//
//    }
//
//    @Override
//    public int addPeople(People people) {
//        String sql ="insert into people(name,gender,email,birthday,createTime,updateTime) values(?,?,?,?,?,?)";
//        try {
//            return queryRunner.execute(sql, people.getName(), people.getGender(), people.getEmail(), people.getBirthday(), people.getCreateTime(), people.getUpdateTime());
//        } catch (SQLException sqlException) {
//            sqlException.printStackTrace();
//        }
//    return  0;
//
//    }
//
//    @Override
//    public int updatePeople(People people) {
//        return 0;
//    }
//
//    @Override
//    public int deletePeople(int id) {
//        return 0;
//    }
//
//    @Override
//    public People selectPeople(String name) {
//        return null;
//    }
//
//    @Override
//    public PageBean<People> getPageDate(String name, String gender, Date begin, Date end, int currentPage) {
//       PageBean<People> pageBean = new PageBean<>();
//        /**
//         * 每页的数量，默认是10
//         */
//        int pageSize = pageBean.getPageSize();
//        /**
//         * 通用sql部分后面写 where 1 = 1目的，是因为查询的时候有很多动态条件，我们无法确定哪个判断条件
//         * 会成为 where 后面的第一个条件, 而where后的第一个判断条件和其他的判断条件的区别在于没有 "and"
//         */
//        StringBuffer commonSql = new StringBuffer("select id, name, gender, email, birthday, " +
//                "createTime, updateTime from people where 1 = 1 ");
//
//        return null;
//    }
//}
